package com.sxhuayuan.parking.service;

import com.sxhuayuan.parking.compenent.Page;
import com.sxhuayuan.parking.compenent.Pageable;
import com.sxhuayuan.parking.dto.SumDTO;
import com.sxhuayuan.parking.entity.Agent;
import com.sxhuayuan.parking.entity.Order;
import com.sxhuayuan.parking.entity.OrderRefund;
import com.sxhuayuan.parking.entity.ParkingLotUser;

import java.math.BigDecimal;
import java.time.LocalDate;

public interface OrderRefundService extends BaseService<OrderRefund, Long> {

	/**
	 * 创建退款订单
	 * 
	 * @param order
	 * @param refundMoney
	 * @param note
	 *            备注
	 * @return
	 */
	OrderRefund createRefund(Order order, BigDecimal refundMoney, String note);

	/**
	 * 退款成功，更新订单
	 * 
	 * @param refund
	 */
	void refundSuccess(OrderRefund refund, String msg);

	/**
	 * 根据代理和日期查询支付宝、微信退款
	 * 
	 * @param agent
	 *            代理
	 * @param date
	 *            日期
	 * @return 0：微信退款金额 1：支付宝退款金额
	 */
	BigDecimal[] sumByAgentAndDate(Agent agent, LocalDate date);

	/** 分页查询,代理 */
	Page<OrderRefund> findPage(Pageable pageable, ParkingLotUser parkingLotUser);

	/** 分页查询的统计 退款笔数、金额 */
	SumDTO sumByFindPage(Pageable pageable, ParkingLotUser parkingLotUser);
}
